<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/28
 * Time: 16:32
 */
namespace app\admin\controller;
use app\admin\model\Wholetype as WholetypeModel;
use think\Db;
class Ajax extends Common
{
    //会员信息验证
    public function MemberInfoCheck()
    {
        $Val=input('post.Val','','trim');
        $Field=input('post.Field','','trim');
        $ID=input('post.ID','','abs');
        if(!empty($ID))
        {
            $Info=Db::name('member')->where('MemberID',$ID)->value($Field);
            if($Val==$Info){
                $Back=array();
                $Back['InfoState']=-1;
                $this->result($Back,'0','会员信息');
            }
        }
        $Where=array();
        $Where[$Field]=$Val;
        $State=Db::name('member')->where($Where)->count();
        $Back=array();
        $Back['InfoState']=empty($State) ? '0' : '1';
        $this->result($Back,'0','会员信息');
    }
    //会员信息验证
    public function MemberInfoCheck2()
    {
        $Val=input('post.Val','','trim');
        $Field=input('post.Field','','trim');
        $Where=array();
        $Where[$Field]=$Val;
        $Where['MemberTypeID']=3;
        $State=Db::name('member')->where($Where)->count();
        $Back=array();
        $Back['InfoState']=empty($State) ? '1' : '0';
        $this->result($Back,'0','会员信息');
    }
    //获取会员类别数据
    public function getmemberlist()
    {
        $Name=input('post.Name');
        $List=array();
        if(!empty($Name))
        {
            $MemberModel=new \app\admin\model\Member();
            $List=$MemberModel->GetList($Name);
        }
        return $this->result($List,'0','会员列表数据');
    }
    //获取联级菜单子分类数据
    public function GetSeatListData()
    {
		$WholetypeModel = new WholetypeModel;
        $TableName=input('post.TableName','','trim');
        $TypeID=input('post.TypeID','','abs');
        $List=$WholetypeModel->GetSeatTypeList($TableName,$TypeID);
        $this->result($List,0,'分类列表数据');
    }

	//获取关键词分词
    public function GetSeotitle()
    {
        $Val=input('post.Val','','trim');
		$text=$this->getDescriptionFromContent($content, $count,$replace);
		$this->get_tags($text);        
        $this->result($Back,'0','信息');
    }
}